<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    /** Symbol可以有一个可选的描述，但仅用于调试目的
     * 即使描述符是一样的，但两个Symbol也是不相等的*/
// Symbol can have an optional description, but for debugging purposes only.

// Here are two symbols with the same description:
    let Sym1 = Symbol("Sym");
    let Sym2 = Symbol("Sym");

    console.log(Sym1 === Sym2); // returns "false"
    // Symbols are guaranteed to be unique.
    // Even if we create many symbols with the same description,
    // they are different values.

    console.log(Sym1.description); // Sym1
    console.log(Sym1.toString()); // Symbol(Sym)

    /** 可用数字、字符串、对象进行描述*/
//可以使用描述符描述这个symbol,描述符一般是数字或则字符串
//如果是对象,内部会将描述符 toString
    let s = Symbol({});
    console.log(s); //Symbol([object Object])
</script>
</body>
</html>